﻿#ifndef DATASOURCEIMAGEGDAL_H
#define DATASOURCEIMAGEGDAL_H

#include "datasource.h"
#include <osg/Image>

class GDALDataset;
class DataSourceImageGDAL: public rxtiler::DataSource
{
public:
    DataSourceImageGDAL();
    ~DataSourceImageGDAL();
    // DataSource interface
public:
    bool close();
    bool open();
    rxtiler::Extent getExtent();
    osg::Image *getImage(rxtiler::TileKey &key, rxtiler::Extent &extent);
    osg::Image *getImages(rxtiler::TileKey &key, rxtiler::Extent &extent);
protected:
    GDALDataset *poDataset{0};
    //int _bandCount;
    rxtiler::Extent _tif;

    osg::Image *__read(int windowX,int windowY,
                       int windowWidth,int windowHeight,
                       int destWidth,int destHeight
                       );

    osg::Image *__reads(int windowX,int windowY,
                       int windowWidth,int windowHeight,
                       int destWidth,int destHeight
                       );
};


#endif // DATASOURCEIMAGEGDAL_H
